<?php
class Controller_Test_Test extends Controller
{
    public function __construct ($request, $response)
    {
        parent::__construct($request, $response);
    }

    public function action_sms ()
    {
        Util_SMSSP::instance()->send('17090136823', '测试');
    }

    public function action_update_shop_score ()
    {
        $pinglun = new App_Order_Pinglun();
        $pinglun->updateShopScore();
    }

    public function action_rate()
    {
        $data = Util_ExchangeRate::Euro2RMB(1.55);
        var_dump($data);
    }

    /*
     *  1.【#company#】您的验证码是#code#
        2.【#company#】您的验证码是#code#。如非本人操作，请忽略本短信
        3.【#company#】亲爱的#name#，您的验证码是#code#。如非本人操作，请忽略本短信
        4.【#company#】亲爱的#name#，您的验证码是#code#。有效期为#hour#小时，请尽快验证
        5.【#company#】感谢您注册#app#，您的验证码是#code#
        6.【#company#】欢迎使用#app#，您的手机验证码是#code#。本条信息无需回复
        7.【#company#】正在找回密码，您的验证码是#code#
        8.【#company#】激活码是#code#。如非本人操作，请致电#tel#
        9.【#company#】#code#(#app#手机动态码，请完成验证)，如非本人操作，请忽略本短信

        使用说明:
            选择对应的模板id,将#变量#替换成对应的值(#company#可以在后台中设置，目前只能使用哇呀旅行)
           eg.
                $tpl_id = 4;
                $tpl_value = "#company#=哇呀旅行&#name#=李白&#code#=1234&#hour#=1";
     */
    public function action_yunpian_sms(){
//        $apikey = "51460d0b8d8d6b64c4ee4f8c63adb68f"; //请用自己的apikey代替
        $mobile = "+8618041130395"; //请用自己的手机号代替
//        $tpl_id = 1; //对应默认模板 【#company#】您的验证码是#code#
//        $tpl_value = "#company#=哇呀旅行&#code#=1234";
        $tpl_id = 1196619;
        $tpl_value = "#guide#=哇呀旅行&#time#=2015-12-18";
        $sms_obj = new Util_YunPianSms();
        echo $sms_obj->send_sms_to_user_id($tpl_id, $tpl_value, $mobile);
        echo 123;
        exit;
    }

    public function action_guider(){
        $guider = new Util_Tourist();
        $data = $guider->touristEmail(76);
        $tourist = new Tourist(76);
        $data = $tourist->getUserInfo();
        var_dump($data);
        exit;
    }

    public function action_notice(){
//         $title="测试路线";
//         $name="哇吖";
//         $notice = "预订了".$name."的《{$title}》，请尽快前去个人中心预定记录的预定申请中处理。";
//         Util_Notice::addNotice(1,132,$notice);
         $orderNo="201603230004031559";
         $log = new Order_Log($orderNo);
         $data = DB::select('shopId','title','startDay','stopDay','moneyTotalRMB','persons')
                    ->from('app_order')
                    ->where('orderNo', '=', $orderNo)
                    ->execute()
                    ->current();
                $sd = Arr::get($data,'startDay');
                $sd = date('Y年m月d日',strtotime($sd));
                $log->add("玩伴接受了预定,行程将于".$sd."开始");
//          $user = user::currentUser();
//        $uid = $user->getUserUid();
//        var_dump($uid);
//        $data = Util_Notice::notice_unread($uid);
//        $data = Util_Notice::noticeDetail(17);
//        $data = Util_Notice::noticeList();
//        var_dump($data);
    }

    public function action_comments(){
        Comments::getActivityOrTrackComments(4,"activity");
    }


    public function action_mail(){
        $rs = User_Subscribe::post_email('498778905@qq.com','test','test');
        var_dump($rs);
    }

    public function action_order(){
        $order = new Order;
        $order->setOrdersPaidByTransactionId(40);

    }
}
